package com.mysql.entity;

import java.time.LocalDateTime;
import java.util.Date;

public class Staffs {
    private int id;
    private String name;
    private int age;
    private String phone;
    private String staPos;
    private LocalDateTime addTime;
    private LocalDateTime updateTime;

    public Staffs() {
    }
    public Staffs(int id, String name, int age, String phone, String staPos, LocalDateTime addTime, LocalDateTime updateTime) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.phone = phone;
        this.staPos = staPos;
        this.addTime = addTime;
        this.updateTime = updateTime;
    }

    public Staffs(String name, int age, String phone, String staPos) {
        this.name = name;
        this.age = age;
        this.phone = phone;
        this.staPos = staPos;
    }

    public int getId() { // 修改字段名大小写
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getStaPos() {
        return staPos;
    }

    public void setStaPos(String staPos) {
        this.staPos = staPos;
    }

    public LocalDateTime getAddTime() {
        return addTime;
    }

    public void setAddTime(LocalDateTime addTime) {
        if (addTime == null) {
            addTime =  LocalDateTime.now(); // 使用 LocalDateTime.now()
        }
        this.addTime = addTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        if (updateTime == null) {
            updateTime = LocalDateTime.now(); // 使用 LocalDateTime.now()
        }
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return  "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", phone='" + phone + '\'' +
                ", staPos='" + staPos + '\'' +
                ", addTime=" + addTime +
                ", updateTime=" + updateTime;
    }
}